package com.atung.parking.controller;

import com.atung.parking.config.permission.PermissionValid;
import com.atung.parking.config.result.ApiResult;
import com.atung.parking.enums.AdminType;
import com.atung.parking.response.page.OneselfMenuResponse;
import com.atung.parking.service.impl.MenuManageServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/api/menu")
@Api(tags = "菜单管理")
public class MenuManageController {

    @Resource
    private MenuManageServiceImpl menuManageService;

    @GetMapping("/oneself")
    @ApiOperation("获取自己菜单列表")
    @PermissionValid(roleType = {AdminType.ADMIN,AdminType.SUPERADMIN})
    public ApiResult queryOneself() {
        List<OneselfMenuResponse> oneselfMenuResponses = menuManageService.queryOneselfService();
        return ApiResult.ok(oneselfMenuResponses);
    }

}
